package com.hopital5.zhangyz.controller;

import com.hopital5.zhangyz.service.PeopleService;
import com.hopital5.zhangyz.vo.request.LabelVoRequest;
import com.hopital5.zhangyz.vo.request.PeopleVoRequest;
import com.hopital5.zhangyz.vo.response.LabelVoResponse;
import com.hopital5.zhangyz.vo.response.PeopleVoResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/people")
public class PeopleController extends BaseController {
    @Autowired
    PeopleService peopleService;

    @PutMapping
    public PeopleVoResponse insert(@RequestBody PeopleVoRequest peopleVoRequest) {
        return PeopleVoResponse.build(peopleService.save(peopleVoRequest));
    }

    @PostMapping
    public PeopleVoResponse update(@RequestBody PeopleVoRequest peopleVoRequest) {
        return PeopleVoResponse.build(peopleService.update(peopleVoRequest));
    }
}
